package com.endurance.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 读取自定义配置文件中的内容
 */
@RestController
@PropertySource("classpath:config/student.properties")
public class StudentController {

    // 通过value读取配置文件中的值
    @Value("${student.username}")
    private String username;

    @Value("${student.password}")
    private String password;

    @RequestMapping("/student")
    @ResponseBody
    public String hello() {
        return username + ":" + password;
    }

}
